package network;

import java.awt.Image;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 * IconManager passes icon's for rendering between the source folders and the runtime.
 * 
 * All functions are static
 * 
 * @author Oliver Behncke 
 * @author Holly Denton 
 * @author Matthew McCarthy
 * @author John Quinlivan
 *
 */
public class IconManager {

	/**
	 * No instantiation
	 */
	private IconManager() {}
	
	/**
	 * Returns the icon of the server image 
	 * 
	 * @return Returns an icon for the server
	 */
	public static Icon getServerIcon() {
		try {
			return new ImageIcon(ImageIO.read(new File("icons/serverRequestIcon.png")));
		} catch (IOException e) {
			return null;
		}
	}

	/**
	 * Returns the window icon for the OS to plant where appropriate
	 * 
	 * @return An image to display on the window
	 */
	public static Image getWindowIcon() {
		try {
			return ImageIO.read(new File("icons/packageIcon.png"));
		} catch (Exception e) {
			System.out.println("Error loading package icon!");
			e.printStackTrace();
			return null;
		}
	}

}
